﻿// Copyright (c) 2017 GlassGrass

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;



namespace GlassGrass.Unity.GuiFramework
	{
	/// <summary> Text label. </summary>
	public class Label : GuiElement
		{
		/// <summary> Create Label instance. </summary>
		/// <param name="config"> [Non-Nullable] </param>
		/// <exception cref="System.ArgumentNullException"></exception>
		public Label(GuiConfig config) : base(config)
			{
			}



		/// <summary> Define what to choose style for this from skin. </summary>
		/// <param name="skin"></param>
		/// <returns></returns>
		protected override GUIStyle ChooseStyle(GUISkin skin)
			=> skin?.label;


		
		/// <summary> Define how to layout manually itself on rendering frame. </summary>
		/// <param name="parentSkin"></param>
		public override void LayoutManual(GUISkin parentSkin)
			=> GUI.Label(Rect, Content, SelectValidStyle(parentSkin));
		


		/// <summary> Define how to layout automatically itself on rendering frame.  </summary>
		/// <param name="parentSkin"></param>
		public override void LayoutAuto(GUISkin parentSkin)
			=> GUILayout.Label(Content, SelectValidStyle( parentSkin ), LayoutOptions);

		}
	}
